home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 21
/
Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso
/
Aminet
/
comm
/
tcp
/
AminetFTPb.lha
/
AminetFTPb.yam
< prev
Wrap
Text File
|
1997-08-23
|
7KB
|
241 lines
/* $VER: AminetFTPb.yam 1.1 (23 AUG 97)
** by Charles Patterson <midian@azstarnet.com>
** http://www.azstarnet.com/~midian
**
** Localization by Marc Hemes <marc.hemes@braunschweig.netsurf.de
**
** Description: This script finds your "Today's Aminet Upload" email in
** YAM, lists the files so you can choose which ones you want
** to download, then uses AmFTP to download the selected files.
**
** Requirements: YAM 1.3.4 (© 1995-96 Marcel Beck)
** TCP/IP Stack
** rexxreqtools.library 1.3 (© 1992-94 Rafael D'Halleweyn)
** AmFTP 1.75 (© 1995-97 Mathias Michler)
**
** Instructions: Send email to listproc@mail.wustl.edu with the body:
** SUBSCRIBE aminet-daily Your Name
** or SUBSCRIBE aminet-weekly Your Name
** Copy this file to YAM:Rexx/
** Set FILES to the number of files you want listed at a time
** Open the YAM:.config file and add this line:
** RexxMenu1 = YAM:Rexx/AminetFTP.yam
** Change the AMFTP, AMINET and LOCALDIR settings in script
** Download your email then run this script from the YAM
** ARexx menu.
**
** --- Files listed: --- */
FILES = 10
/* --- Path to run AmFTP: --- */
AMFTP="DH2:Applications/AmFTP/AmFTP"
/* --- Local Aminet Site: --- */
AMINET="wuarchive.wustl.edu"
/* --- Local directory Site: --- */
LOCALDIR="DH2:Lookat"
today = "Today's Aminet "
weekly = "This week's Ami"
OPTIONS RESULTS
ADDRESS YAM
IF ~SHOW('L','rexxsupport.library') THEN
ADDLIB('rexxsupport.library',0,-30,0)
IF ~SHOW('L','rexxreqtools.library') THEN
ADDLIB('rexxreqtools.library',0,-30,0)
NL = '0A'x
IF OPEN('localeprefs','ENV:sys/locale.prefs','R') THEN DO
language = SUBSTR(READCH('localeprefs', 113), 83, 29)
language = SUBSTR(language, 1, POS(D2C(0), language) - 1)
CLOSE('localeprefs')
END
SELECT
WHEN language = 'deutsch' THEN DO /* german text */
MSG_NOMAIL = "Keine E-Mails im Ordner !"
MSG_ASKCHECK = "Welche möchten Sie prüfen ?"
MSG_ASKCHECK_GAD = "Heu_te|_Woche|Alle tä_glichen|Alle wöch_entlichen|_Alle|Abbru_ch"
MSG_MAILNOTFOUND = "E-Mails mit Aminet-Uploads nicht gefunden !"
MSG_LISTFILES = "Dateien aus welchen E-Mails auflisten ?"
MSG_LISTFILES_GAD = "Au_sgewählte|_Andere"
MSG_FILES = "Dateinummern eingeben (z.B. 1 2 5)"
MSG_FILES_GAD = "_Ok|_Fertig|_Abbruch"
MSG_README = "Möchten Sie für jede Datei auch auch die zugehörigen .readme-Dateien ? "
MSG_README_GAD = "_Ja|_Nein"
END
OTHERWISE DO /* english text */
MSG_NOMAIL = "No email in folder!"
MSG_ASKCHECK = "Do you wish to check"
MSG_ASKCHECK_GAD = "_Today's|_Week's|All _dailys|All w_eeklys|_All|_Cancel"
MSG_MAILNOTFOUND = "Aminet Uploads email not found!"
MSG_LISTFILES = "List files in:"
MSG_LISTFILES_GAD = "_Selected|_Other"
MSG_FILES = "Enter filenumbers (ie. 1 2 5)"
MSG_FILES_GAD = "_Ok|_Finished|_Cancel"
MSG_README = "Do you want each file's .readme as well?"
MSG_README_GAD = "_Yes|_No"
END
END
INFO SCREEN
pubscreen = result
GETFOLDERINFO MAX
entries=result
IF entries=0 THEN
DO
test=RTEZREQUEST(MSG_NOMAIL,"_Ok",,"rt_pubscrname="pubscreen)
EXIT
END
lfi = 0
t = 0
checkn = 0
filename. = ''
GETMAILINFO SUBJECT
sub = LEFT(RESULT,15)
IF sub = today | sub = weekly THEN
DO
test=RTEZREQUEST(MSG_LISTFILES,MSG_LISTFILES_GAD,,"rt_pubscrname="pubscreen)
lfi = rtresult
END
IF lfi THEN
DO
t = 1
GETMAILINFO FILE
filename.1 = RESULT
END
ELSE
DO
test=RTEZREQUEST(MSG_ASKCHECK,MSG_ASKCHECK_GAD,,"rt_pubscrname="pubscreen)
checkn = rtresult
IF checkn = 0 THEN EXIT
IF checkn = 1 | checkn = 3 THEN check = today
IF checkn = 2 | checkn = 4 THEN check = weekly
DO n = entries-1 TO 0 BY -1
SETMAIL n
GETMAILINFO SUBJECT
sub = LEFT(RESULT,15)
IF checkn = 5 THEN
DO
IF sub = today | sub = weekly THEN
DO
t = t + 1
GETMAILINFO FILE
filename.t = RESULT
END
END
ELSE
IF sub = check THEN
DO
t = t + 1
GETMAILINFO FILE
filename.t = RESULT
END
END
END
IF t = 0 THEN
DO
test=RTEZREQUEST(MSG_MAILNOTFOUND,"_Ok",,"rt_pubscrname="pubscreen)
EXIT
END
IF checkn < 3 THEN t = 1
DO mail = 1 to t
line. = ''
ADDRESS COMMAND 'COPY 'filename.mail' TO T:FTPMail.rct'
OPEN('recent','T:FTPMail.rct','R')
DO UNTIL LEFT(READLN('recent'),3) = '|--'
END
i=0
DO WHILE ~EOF('recent')
i=i+1
line.i=READLN('recent')
IF LEFT(line.i,1) = '|' THEN BREAK
IF STRIP(line.i) = '' THEN i=i-1
END
CLOSE('recent')
c = 0
w = i%FILES
IF i//FILES >0 THEN w = w + 1
DO n = 1 to w
DO f = n*FILES-(FILES-1) to n*FILES
PARSE VAR line.f file.f dir.f size.f '+' desc.f
file.f = LEFT(file.f,18,' ')
dir.f = LEFT(dir.f,10,' ')
size.f = RIGHT(size.f,4,' ')
desc.f = LEFT(desc.f,37,)
END
reqstr = ''
DO x = f-FILES to f-1
y=x
if y<10 then y=' '||y
reqstr = reqstr || y'. 'file.x' 'dir.x' 'size.x' 'desc.x||NL
END
input = RTGETSTRING(,reqstr,MSG_FILES,MSG_FILES_GAD,"rt_pubscrname="pubscreen)
IF rtresult = 2 THEN BREAK
DO WHILE input ~= ''
c = c+1
PARSE VAR input filenum.c input
j = filenum.c
IF STRIP(file.j) = '' THEN c = c-1
END
END
close = 0
IF c > 0 THEN
DO
test=RTEZREQUEST(MSG_README,MSG_README_GAD,,"rt_pubscrname="pubscreen)
read = rtresult
IF ~SHOW('P',AMFTP.1) THEN
DO
ADDRESS COMMAND RUN AMFTP
ADDRESS COMMAND WAITFORPORT AMFTP.1
close=1
END
ADDRESS 'AMFTP.1'
CALL OPENPORT("AMFTP-RESULT.1")
CHANGELOCALDIR LOCALDIR
CONNECTHOST AMINET
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
DO mc = 1 to c
d = filenum.mc
dir = "/pub/aminet/"||STRIP(dir.d)
CHANGEDIR dir
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
'BATCH' file.d
IF read THEN DO
lgt = LENGTH(COMPRESS(file.d))-3
filer = LEFT(file.d,lgt)||"readme"
'BATCH' filer
END
PULL wait
END
RECEIVEBATCH
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
'CLOSE'
CALL CLOSEPORT "AMFTP-RESULT.1"
IF close THEN QUIT
END
END
ADDRESS COMMAND 'DELETE T:FTPMail.*'
EXIT